import 'package:flutter/material.dart';
import 'package:flutter_stort/utils/jump_util.dart';
import 'package:flutter_stort/utils/toast_utils.dart';

///意见反馈
class FeedbackPage extends StatefulWidget {
  @override
  _FeedbackPageState createState() => _FeedbackPageState();
}

class _FeedbackPageState extends State<FeedbackPage> {
  GlobalKey<FormState> _feedbackKey = GlobalKey();
  String _content;
  ///提交
  void _submit() {
    _feedbackKey.currentState.save();
    if(_content.isNotEmpty) {
      ToastUtil.showToast("提交成功");
      JumpPageUtils.clostPage(context);
    }else{
      ToastUtil.showToast("请输入您要反馈的意见！");
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "意见反馈",
          style: TextStyle(
            color: Colors.white,
            fontSize: 20,
          ),
        ),
        actions: [
          FlatButton(
            onPressed: _submit,
            child: Text(
              "提交",
              style: TextStyle(color: Colors.white, fontSize: 16),
            ),
          ),
        ],
      ),
      body: Container(
        color: Colors.white,
        padding: EdgeInsets.all(10),
        child: Form(
          key: _feedbackKey,
          child: TextFormField(
            minLines: 8,
            maxLines: 8,
            decoration: InputDecoration(
              hintText: "请输入您反馈的意见！",
              border: InputBorder.none,
            ),
            onEditingComplete: () {},
            onSaved: (value) {
              this._content = value;
            },
          ),
        ),
      ),
    );
  }
}
